package com.droidblackbox.accident;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;

import com.droidblackbox.DroidBlackBoxLogo;
import com.droidblackbox.R;
import com.droidblackbox.manager.C2DMManager;

public class AccidentReceiveInfoView extends Activity implements OnClickListener {

	private TextView titleTextView = null;
	private TextView messageTextView = null;

	private Button viewButton = null;
	private Button closeButton = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.accident_main);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
				WindowManager.LayoutParams.FLAG_BLUR_BEHIND);

		WindowManager.LayoutParams myWindow = new WindowManager.LayoutParams();
		myWindow.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
		myWindow.dimAmount = 0.5F;
		getWindow().setAttributes(myWindow);

		titleTextView = (TextView) findViewById(R.id.titleTextView);
		messageTextView = (TextView) findViewById(R.id.messageTextView);

		float textSize = getResources().getDimension(R.dimen.text_size);
		float titleTextSize = textSize + 20.0F;
		float messageTextSize = textSize + 10.0F;
		titleTextView.setTextSize(titleTextSize);
		messageTextView.setTextSize(messageTextSize);

		viewButton = (Button) findViewById(R.id.viewButton);
		closeButton = (Button) findViewById(R.id.closeButton);

		viewButton.setOnClickListener(this);
		closeButton.setOnClickListener(this);
	}

	public void onClick(View v) {
		if (v == viewButton) {
			Intent intent = getIntent();
			Bundle bundle = intent.getExtras();
			String string = bundle.getString(C2DMManager.EXTRA_KEY);

			intent = new Intent(AccidentReceiveInfoView.this, DroidBlackBoxLogo.class);
			intent.putExtra(C2DMManager.EXTRA_KEY, string);
			startActivity(intent);
		}

		finish();
	}

}
